<!DOCTYPE html>
<html class="loading" lang="en" data-textdirection="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="author" content="PIXINVENT">
<title>自助售货管理后台</title>
<link rel="stylesheet" type="text/css" href="app-assets/css/vendors.css">
<link rel="stylesheet" type="text/css" href="app-assets/css/vertical-menu.css">
<link rel="stylesheet" type="text/css" href="app-assets/css/bootstrap-extended.css">
</head>
<body>
<div class="content-wrapper">
  <div class="content-header ">
    <div class="content-header-left mb-2 clearfix">
		
      <h3 class="content-header-title mb-0 pull-left">新增员工</h3>
		<ol class="breadcrumb pull-right">
                <li><a href="员工列表.html">员工列表</a></li>
                        <li class="active">编辑商品信息</li>
                    </ol>
    </div>
  </div>
  <div class="card">
    <div class="card-content">
      <div class="card-body">
        <div class="funcbtn clearfix">
          <div class="pull-left"><a class="btn btn-default" href="员工列表.html">返回</a></div>
        </div>
        <div class="form1 form3" id="employeeForm">
				<ul class="row">
					<li class="col-sm-10 col-xs-12">
						<span>登录名：</span>
						<input type="text" class="form-control" value="test" name="loginName">
					</li>
					<li class="col-sm-10 col-xs-12"><span>用户名：</span><input type="text" class="form-control" name="empName"></li>
					<li class="col-sm-10 col-xs-12"><span>密码：</span><input type="text" class="form-control" name="password"></li>
					<li class="col-sm-10 col-xs-12"><span>职位：</span><input type="text" class="form-control" name="position"></li>
					<li class="col-sm-10 col-xs-12"><span>电子邮件：</span><input type="text" class="form-control" name="email"></li>
					<li class="col-sm-10 col-xs-12"><span>手机号码：</span><input type="text" class="form-control" name="phoneNumber"></li>
					<li class="col-sm-10 col-xs-12"><span>工资</span><input type="text" class="form-control" name="salary"></li>
				<li class="col-sm-10 col-xs-12"><input class="btn btn-primary" value="确认保存" id="insertInto"></li>
					</ul>
				</div>
      </div>
    </div>
  </div>
</div>


<script src="app-assets/js/vendors.min.js" type="text/javascript"></script> 
<script src="app-assets/js/app-menu.js" type="text/javascript"></script> 
<script src="app-assets/js/app.js" type="text/javascript"></script> 
<script src="app-assets/js/echarts.min.js" type="text/javascript"></script> 

</body>
</html>
<script>
	$(function(){
		console.log(window.sessionStorage.getItem("empName"))
            var loginMessage = window.sessionStorage.getItem("empName")
            if(loginMessage==null){
                alert("请先登录")
                window.location.href="./index.html"
            }
	})
	$('#insertInto').on("click",function(){
		event.preventDefault();
		var loginName = $('input[name="loginName"]').val()
		var empName = $('input[name="empName"]').val()
		var password = $('input[name="password"]').val()
		var position = $('input[name="position"]').val()
		var email = $('input[name="email"]').val()
		var phoneNumber = $('input[name="phoneNumber"]').val()
		var salary = $('input[name="salary"]').val()
		var formDate = {
			loginName:loginName,
			empName:empName,
			password:password,
			position:position,
			email:email,
			phoneNumber:phoneNumber,
			salary:salary
		}
		$.ajax({
			url:"http://localhost:18081/employees/insertInto",
			type:"post",
			data:formDate,
			success:function(data){
				alert(data.message)
				window.location.href = "员工列表.html"
			}
		})
	})
</script>